<template>
  <el-button
    
    round plain
    :type="opinionStatusName(status).type"
    @click="changeStatus"
  >{{opinionStatusName(status).name}}</el-button>
</template>

<script>
export default {
  props: ["status"],
  computed: {
    // 传递 单位类型 查询 单位list
    opinionStatusName() {
      return (types) => {
        if (types === 0) {
          return {
            name: "待审批",
            type: "primary",
          };
        } else if (types === 1) {
          return {
            name: "已审批",
            type: "success",
          };
        } else if (types === 2) {
          return {
            name: "已驳回",
            type: "danger",
          };
        } else {
          return {
            name: "待发起",
            type: "info",
          };
        }
      };
    },
  },
  methods: {
    changeStatus() {
      if(this.status !== null && this.status !== undefined  && this.status !== 3) {
        this.$emit('change', this.status)
      }
    },
  }
};
</script>

<style>
</style>
